// Copyright © SixtyFPS GmbH <info@slint.dev>
// SPDX-License-Identifier: GPL-3.0-only OR LicenseRef-Slint-Royalty-free-1.2 OR LicenseRef-Slint-commercial


import { Slider } from "std-widgets.slint";
export component TestCase inherits Window {
    width: 100px;
    height: 100px;
    slider := Slider {
        minimum: 0;
        maximum: 100;
        value: 10;
    }

    forward-focus: slider;
    out property <bool> slider-focused <=> slider.has_focus;
    callback released <=> slider.released;
    callback changed <=> slider.changed;
}

/*


```rust
use slint::platform::Key;
use std::cell::RefCell;
use std::rc::Rc;

let instance = TestCase::new().unwrap();

let edits = Rc::new(RefCell::new(Vec::new()));
let changes = Rc::new(RefCell::new(Vec::new()));

instance.on_released({
    let edits = edits.clone();
    move |val| {
    edits.borrow_mut().push(val);
}});

instance.on_changed({
    let changes = changes.clone();
    move |val| {
    changes.borrow_mut().push(val);
}});

slint_testing::send_mouse_click(&instance, 5., 5.);
assert!(edits.borrow().is_empty());
assert!(changes.borrow().is_empty());
assert!(instance.get_slider_focused());

slint_testing::send_keyboard_char(&instance, Key::RightArrow.into(), true);
slint_testing::send_keyboard_char(&instance, Key::RightArrow.into(), true);
slint_testing::send_keyboard_char(&instance, Key::RightArrow.into(), true);
slint_testing::send_keyboard_char(&instance, Key::RightArrow.into(), true);
slint_testing::send_keyboard_char(&instance, Key::RightArrow.into(), false);
// Send bogus key to verify that it doesn't trigger released
slint_testing::send_keyboard_char(&instance, 'a', true);
slint_testing::send_keyboard_char(&instance, 'a', false);

assert_eq!(edits.borrow().clone(), vec![14f32]);
assert_eq!(changes.borrow().clone(), vec![11f32, 12f32, 13f32, 14f32]);

```

*/
